﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace DevWeb.Biztalk.DeploymentSettings.WebUI.Models
{
    public class IntegrationViewModel : BaseViewModel, IValidatableObject
    {
        [Display(Name = "ProjectName",
            Description = "This is the projectname in the BTDFProj file")]
        [DisplayName("Project Name")]
        [Required(ErrorMessage = "ProjectName is required")]
        [StringLength(500, ErrorMessage = "Between 4 and 500 Chars is allowed", ErrorMessageResourceName = null,
            ErrorMessageResourceType = null, MinimumLength = 4)]
        public string Name { get; set; }

        [Display(Name = "Description",
            Description = "This is the description of the Integration")]
        [DisplayName("Project Description")]
        public string Description { get; set; }

        [Display(Name = "ProductUpgradeCode",
            Description = "This is the ProductUpgradeCode in the BTDFProj file")]
        [Required(ErrorMessage = "ProductUpgradeCode is required")]
        public Guid ProductUpgradeCode { get; set; }

        [Display(Name = "CreateDateTime",
            Description = "This is the current Timestamp.")]
        [Required(ErrorMessage = "CreateDateTime is required")]
        public DateTime CreateDateTime { get; set; }

        [Display(Name = "VersionCount",
            Description = "This is number of versions in the DB.")]
        [ReadOnly(true)]
        public int VersionCount { get; set; }

        [Display(Name = "Versions",
            Description = "This is a array of versionnummers in the DB.")]
        [ReadOnly(true)]
        [HiddenInput(DisplayValue = false)]
        public string[] Versions { get; set; }

        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            return new BindingList<ValidationResult>();
        }
    }
}